local ma__jinqu = fk.CreateSkill {
  name = "ma__jinqu",
}

Fk:loadTranslationTable{
  ["ma__jinqu"] = "进趋",
  [":ma__jinqu"] = "你可以跳过弃牌阶段并摸两张牌，然后将手牌弃至X张（X为你本回合发动〖奇制〗的次数+1）。",

  ["#ma__jinqu-invoke"] = "进趋：是否跳过弃牌阶段并摸两张牌，然后将手牌弃至%arg张？",

  ["$ma__jinqu1"] = "和远在身，定众在心。",
  ["$ma__jinqu2"] = "亲用忠良，远近协服。",
}

ma__jinqu:addEffect(fk.EventPhaseChanging, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(ma__jinqu.name) and data.phase == Player.Discard
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askToSkillInvoke(player, {
      skill_name = ma__jinqu.name,
      prompt = "#ma__jinqu-invoke:::"..player:usedSkillTimes("ma__qizhi", Player.HistoryTurn) + 1
    })
  end,
  on_use = function(self, event, target, player, data)
    player:skip(data.phase)
    data.skipped = true
    player:drawCards(2, ma__jinqu.name)
    if player.dead then return end
    if player:usedSkillTimes("ma__qizhi", Player.HistoryTurn) + 1 < player:getHandcardNum() then
    local n = player:getHandcardNum() - (player:usedSkillTimes("ma__qizhi", Player.HistoryTurn) + 1)
      player.room:askToDiscard(player, {
        min_num = n,
        max_num = n,
        include_equip = false,
        skill_name = ma__jinqu.name,
        cancelable = false,
      })
    end
  end,
})

return ma__jinqu